﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="styles/my_style.css" rel="stylesheet" />
    <script src="scripts/jquery-1.6.2.min.js"></script>
    <script src="scripts/jquery.cookie.js"></script>
</head>
<body>


    <script>
              

        alert($.cookie('myCookie'));

        // delete cookie  
        $.cookie('myCookie', null);
        $.cookie('myCookie_date', null);

        alert($.cookie('myCookie'));

        var textContent = "xxxx"
        var expireDays = 10;
        var tmp = new Date();
        tmp.setDate(tmp.getDate() + 1);


        var now = new Date().getTime();
        //var expireDate = now + (1000 * 60 * 60 * 24 * expireDays);
        var expireDate = tmp.toLocaleString();
        //alert(expireDate);
        alert("1");
        //$.cookie("myCookie", '{"data": "' + textContent + '", "expires": ' + expireDate + '}', { expires: expireDays });

        $.cookie('myCookie', 'the_value', { expires: tmp }); //쿠키의 유효기간을 +1일간으로 지정
        $.cookie('myCookie1', 'the_value1', { expires:10 }); //쿠키의 유효기간을 +1일간으로 지정
        $.cookie('myCookie_date', expireDate, { expires: tmp }); //쿠키의 유효기간을 +1일간으로 지정




        alert("2");

        var now = new Date().getTime();

        alert($.cookie('myCookie'));
        alert($.cookie('myCookie_date'));

        //var cookie = $.parseJSON($.cookie("myCookie"));
        //alert("3");
        //var timeleft = cookie.expires - now;
        //alert(cookie.expires);
        //var cookieData = cookie.data;



    </script>

</body>
</html>
